﻿using GraphProcessor;
using IQIGame.Onigao.Logic;
using LFloatMath.Math;
using UnityEngine.Serialization;

namespace IQIGame.Onigao.GamePlay.Editors
{
    [System.Serializable, NodeMenuItem(SkillEditorConst.SkillEffective + "/" + SkillEditorConst.HpToShield, typeof(SkillEditorGraph))]
    public class SkillEffectiveNode_HpToShield : SkillEffectiveNode
    {
        protected override ESkillEffectiveType effectType => ESkillEffectiveType.HpToShield;

        [Input("扣血量公式"), ShowAsDrawer] public int hpFormula;
        [Input("护盾转换比例"), ShowAsDrawer] public float shieldRate;
        [Input("护盾BuffID"), ShowAsDrawer] public int duration;
        
        protected override SkillCustomConfig CreateConfig()
        {
            var rConfig = new SkillEffective_HpToShield_ConfigData()
            {
                hpFormula = this.hpFormula,
                shieldRate = new LFloat(false, this.shieldRate)._val,
                shieldBuffID = this.duration,
            };
            return rConfig;
        }
    }
}